// 使用assert断言返回值类型  返回void类型
function isString(value: unknown): asserts value is string {
  if (typeof value !== "string") throw new Error("Not a string");
}

const s: string | number =45;
isString(s)


